import 'package:kmxy_base/base/base_package.dart';
import 'package:kmxy_base_example/page/location_data/location_data_page_state.dart';

class LocationDataPageView extends LocationDataPageState {
  @override
  Widget setPageContent(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text(
          '高德定位数据',
          style: TextStyle(
            color: Colors.white,
            fontWeight: FontWeight.w700,
          ),
        ),
      ),
      body: SafeArea(
        child: Container(
          width: widthScreen,
          color: Colors.white,
          child: Column(
            children: [
              TextButton(onPressed: startLocation, child: const Text("开始定位")),
              TextButton(onPressed: stopLocation, child: const Text("停止定位")),
              Container(
                width: widthScreen,
                color: Colors.white,
                child: Text(locationResult.toString()),
              ),
              Expanded(
                child: ListView(
                  children: List.generate(
                      dataList.length,
                      (index) => Text(
                          '${dataList[index]['locationCount']}-(${dataList[index]['latitude']},${dataList[index]['longitude']})')),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
